:root {
    --background-pink: #FFF5F5;
    --text-color: #666666;
    --wave-color: #FFFFFF;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-pink);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    width: 100%;
    min-height: 100vh;
    position: relative;
    background-image: url('../img/bj.png');
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    aspect-ratio: 9/16;
    max-width: 500px;
    margin: 0 auto;
}

/* 顶部波浪装饰 */
.wave-decoration {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1200 30" xmlns="http://www.w3.org/2000/svg"><path d="M0,30 C300,30 300,0 600,0 C900,0 900,30 1200,30 L1200,0 L0,0 Z" fill="%23FFFFFF"/></svg>');
    background-size: 100% 100%;
    background-repeat: no-repeat;
}

/* 主要内容区样式 */
.content {
    position: relative;
    width: 100%;
    padding: 0 20px;
    z-index: 2;
    margin-top: 15%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.content-box {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    padding: 25px 20px;
    box-shadow: 0 4px 20px rgba(255, 182, 193, 0.2);
    backdrop-filter: blur(5px);
    text-align: center;
    position: relative;
    z-index: 3;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 15px;
    flex-shrink: 0;
}

h1 {
    color: var(--text-color);
    text-align: center;
    margin-bottom: 20px;
    font-size: clamp(1.5em, 5vw, 2em);
    color: #ff9db7;
    font-weight: bold;
}

/* 爱的告白样式 */
.love-text {
    margin-top: 10px;
    font-size: clamp(1.2em, 3vw, 1.5em);
    color: #ff9db7;
    font-weight: 500;
    letter-spacing: 1px;
}

@keyframes heartbeat {
    0% {
        transform: scale(1);
    }
    14% {
        transform: scale(1.1);
    }
    28% {
        transform: scale(1);
    }
    42% {
        transform: scale(1.1);
    }
    70% {
        transform: scale(1);
    }
}

/* 响应式设计 */
/* 大屏幕设备 */
@media (min-width: 1200px) {
    .content-box {
        padding: 30px 25px;
    }

    .countdown {
        gap: 30px;
    }
}

/* 平板设备 */
@media (max-width: 768px) {
    .content {
        padding: 0 15px;
        margin-top: 12%;
    }

    .content-box {
        padding: 20px 15px;
        width: 100%;
    }

    .countdown {
        gap: 15px;
    }

    .menu {
        gap: 20px;
    }
}

/* 移动设备 */
@media (max-width: 480px) {
    .content {
        padding: 0 10px;
        margin-top: 10%;
    }

    .content-box {
        padding: 15px 12px;
        width: 100%;
        font-size: 14px;
    }

    .countdown {
        gap: 10px;
    }
    
    .time-item {
        padding: 8px 12px;
        min-width: calc(45% - 8px);
        margin-bottom: 8px;
    }
}

/* 超小屏幕设备 */
@media (max-width: 320px) {
    .content-box {
        padding: 10px 8px;
    }

    .time-item {
        padding: 6px 10px;
    }

    .time-item .number {
        font-size: 1.2em;
    }

    .time-item .label {
        font-size: 0.7em;
    }

    .menu {
        gap: 15px;
    }

    .menu-item {
        padding: 5px;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        aspect-ratio: 16/9;
        height: 100vh;
    }
    
    .content {
        padding: 0 10px;
        margin-top: 8%;
    }

    .content-box {
        padding: 15px;
        max-width: 350px;
    }

    h1 {
        margin-bottom: 15px;
    }
}

/* 装饰元素响应式调整 */
@media (max-width: 768px) {
    .decoration {
        opacity: 0.4;
    }

    .flower, .star {
        transform: scale(0.8);
    }
}

@media (max-width: 480px) {
    .flower, .star {
        transform: scale(0.6);
    }
}

/* 添加一些可爱的动画效果 */
@keyframes float {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
    100% {
        transform: translateY(0);
    }
}

.main-character {
    animation: float 3s ease-in-out infinite;
}

/* 添加一些装饰元素的样式 */
.decoration {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
    transition: transform 0.3s ease-out;
}

.flower {
    width: 20px;
    height: 20px;
    background: #ffd1d1;
    border-radius: 50%;
    position: absolute;
    filter: blur(1px);
}

.star {
    width: 15px;
    height: 15px;
    background: #ffe6ee;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    position: absolute;
    filter: blur(1px);
}

/* 倒计时样式 */
.countdown {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 5px 0;
    flex-wrap: wrap;
}

.time-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 192, 203, 0.2);
    padding: 12px 15px;
    border-radius: 12px;
    min-width: clamp(65px, 18vw, 85px);
}

.time-item .number {
    font-size: clamp(1.3em, 3.5vw, 2em);
    font-weight: bold;
    color: #ff9db7;
    margin-bottom: 3px;
}

.time-item .label {
    font-size: clamp(0.8em, 2vw, 1em);
    color: #666;
}

/* 添加装饰元素容器 */
.decoration-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

/* 高屏幕设备优化 */
@media (min-aspect-ratio: 2/3) {
    .content {
        margin-top: 12%;
    }
}

/* 超宽屏优化 */
@media (min-aspect-ratio: 16/9) {
    .container {
        aspect-ratio: 9/16;
        height: 100vh;
    }
    
    .content {
        margin-top: 10%;
    }

    .content-box {
        max-width: 450px;
    }
}

/* iPad 等平板优化 */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .content {
        margin-top: 15%;
    }
}

/* iPhone SE 和其他小屏幕设备优化 */
@media (max-width: 375px) and (max-height: 667px) {
    .content {
        margin-top: 10%;
    }
}

/* 大屏手机优化 */
@media (min-width: 390px) and (max-width: 767px) {
    .content {
        margin-top: 12%;
    }
}

@media (max-width: 500px) {
    .container {
        width: 100%;
        max-width: none;
    }
}

@media (min-width: 501px) {
    .container {
        width: 100%;
        max-width: 500px;
        margin: 0 auto;
    }
}

/* 九宫格相册样式 */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
    background: #ff9db7;
    /* border-radius: 20px; */
    box-shadow: 0 4px 20px rgba(255, 182, 193, 0.2);
    backdrop-filter: blur(5px);
    width: 93%;
    aspect-ratio: 1/1;
    max-width: 100%;
    box-sizing: border-box;
    position: absolute;
    top: 64%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.photo-item {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    overflow: hidden;
    background: rgba(255, 209, 209, 0.5);
    transition: transform 0.3s ease;
    border: 5px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.photo-item::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    width: 30px;
    height: 30px;
    background-image: url('../img/flower3.png'); /* 替换为花朵图片的路径 */
    background-size: cover;
    z-index: 1;
}

.photo-item::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background-image: url('../img/flower2.png'); /* 替换为花朵图片的路径 */
    background-size: cover;
    z-index: 1;
}

.photo-item:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.photo-item img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .photo-grid {
        gap: 3px;
        padding: 3px;
        top: 65%; /* 调整位置 */
        left: 50%;
        width: 95%;
    }
}

@media (max-width: 480px) {
    .photo-grid {
        gap: 2px;
        padding: 2px;
        top: 64%; /* 调整位置 */
        width: 93%;
        left: 50%;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .photo-grid {
        top: 60%; /* 调整位置 */
        width: 90%;
        left: 50%;
    }
}

@media (min-aspect-ratio: 2/3) {
    .photo-grid {
        top: 65%; /* 调整位置 */
        left: 50%;
    }
}

@media (min-aspect-ratio: 16/9) {
    .photo-grid {
        top: 66%; /* 调整位置 */
        left: 50%;
    }
}

.heartbeat-container {
    position: absolute;
    left: 0;
    right: 0;
    width: 95%;
    height: 50px;
    margin: 0 auto;
    overflow: hidden;
    z-index: 3;
}

.heartbeat {
    position: relative;
    width: 100%;
    height: 100%;
}

.line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: draw 5s linear infinite;
    filter: drop-shadow(0 0 2px rgba(255, 157, 183, 0.6));
}

@keyframes draw {
    0% {
        stroke-dashoffset: 1000;
    }
    60% {
        stroke-dashoffset: 0;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .heartbeat-container {
        width: 98%;
        height: 40px;
        bottom: 4%;
    }
}

@media (max-width: 480px) {
    .heartbeat-container {
        width: 100%;
        height: 35px;
        bottom: 2%;
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .heartbeat-container {
        bottom: 2%;
        height: 30px;
    }
}

/* iPad 等平板优化 */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: portrait) {
    .heartbeat-container {
        bottom: 2%;
    }
}

/* 超宽屏优化 */
@media (min-aspect-ratio: 16/9) {
    .heartbeat-container {
        bottom: 0%;
    }
}

.preview-modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    text-align: center;
    border-radius: 10px;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#preview-image {
    width: 100%;
    height: auto;
    margin-bottom: 20px;
}

#download-button {
    padding: 10px 20px;
    background-color: #ff9db7;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s;
}

#download-button:hover {
    background-color: #ff7fa1;
}

.heartbeat-container text {
    cursor: pointer;
    transition: fill 0.3s;
}

.heartbeat-container text:hover {
    fill: #ff7fa1;
}

.image-preview-modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    text-align: center;
    border-radius: 10px;
    position: relative;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

#image-preview {
    width: 100%;
    height: auto;
    margin-bottom: 20px;
}

.watermark {
    position: absolute;
    bottom: 10px;
    right: 10px;
    opacity: 0.5;
    font-size: 20px;
    color: #ff9db7;
    pointer-events: none;
}

@media (max-width: 768px) {
    .heartbeat-container {
        bottom: 0%;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .heartbeat-container {
        bottom: 0%;
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loader {
    position: relative;
    width: 50px;
    height: 50px;
    animation: heartbeat 1.2s infinite;
}

.loader:before,
.loader:after {
    position: absolute;
    content: "";
    left: 25px;
    top: 0;
    width: 25px;
    height: 40px;
    background: #ff69b4;
    border-radius: 25px 25px 0 0;
    transform: rotate(-45deg);
    transform-origin: 0 100%;
    box-shadow: 0 4px 8px rgba(255, 105, 180, 0.3);
}

.loader:after {
    left: 0;
    transform: rotate(45deg);
    transform-origin: 100% 100%;
}

@keyframes heartbeat {
    0% {
        transform: scale(0.8);
    }
    5% {
        transform: scale(0.9);
    }
    10% {
        transform: scale(0.8);
    }
    15% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.8);
    }
    100% {
        transform: scale(0.8);
    }
}

/* 添加可爱的文字提示 */
.loader::before {
    content: "少女心生成中...";
    position: absolute;
    width: 200px;
    text-align: center;
    top: 60px;
    left: -75px;
    color: #ff69b4;
    font-size: 14px;
    font-family: 'Comic Sans MS', cursive;
    animation: textFade 1.2s infinite;
}

@keyframes textFade {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

.add-to-home-screen-prompt {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(255, 255, 255, 0.98);
    padding: 15px 20px;
    padding-top: 20px;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    width: 85%;
    max-width: 320px;
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

.prompt-content {
    position: relative;
}

.close-prompt {
    position: absolute;
    top: -30px;
    right: -30px;
    background: #ff69b4;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 18px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 10000;
}

.close-prompt:hover {
    background: #ff4d94;
    transform: scale(1.1);
    transition: all 0.2s ease;
}

.add-to-home-screen-prompt p {
    margin: 0;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

.share-icon {
    color: #ff69b4;
    font-weight: bold;
}

.arrow-down {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #fff;
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 20px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.time-display {
    position: absolute;
    width: 100%;
    text-align: center;
    color: #ff9db7;
    font-size: 16px;
    font-weight: bold;
    padding: 10px 0;
    /* background-color: rgba(255, 255, 255, 0.9); */
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(255, 105, 180, 0.2);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}